-
Notifications
You must be signed in to change notification settings - Fork 52
Migrate from upstream_hash to tri-part make
#1422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1422 +/- ##
==========================================
- Coverage 71.35% 71.09% -0.26%
==========================================
Files 114 114
Lines 13282 13370 +88
==========================================
+ Hits 9477 9506 +29
- Misses 3805 3864 +59
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes the populate transaction workaround by implementing a tripartite make method pattern across multiple Spyglass tables. The changes split the traditional make method into three distinct methods: make_fetch (data retrieval), make_compute (computation), and make_insert (database insertion).
Key changes:
- Removes
_use_transactionclass attribute and related transaction control logic fromSpyglassMixin.populate() - Refactors 10+ Computed/Imported tables to use the tripartite
make_fetch/make_compute/make_insertpattern - Replaces non-deterministic
uuid.uuid4()calls with deterministicdj.hash.key_hash()for consistent naming
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/conftest.py | Disables GPU for tests via environment variable |
| src/spyglass/utils/dj_mixin.py | Removes transaction control logic and deprecates use_transaction kwarg |
| src/spyglass/spikesorting/v1/metric_curation.py | Refactors to tripartite make pattern |
| src/spyglass/spikesorting/v1/figurl_curation.py | Refactors to tripartite make pattern |
| src/spyglass/spikesorting/v0/spikesorting_sorting.py | Refactors to tripartite make pattern |
| src/spyglass/spikesorting/v0/spikesorting_recording.py | Extracts path validation to separate method |
| src/spyglass/spikesorting/v0/spikesorting_curation.py | Refactors multiple classes to tripartite make pattern |
| src/spyglass/spikesorting/v0/spikesorting_burst.py | Fixes static method call |
| src/spyglass/position/v1/position_dlc_training.py | Refactors to tripartite make pattern |
| src/spyglass/position/v1/position_dlc_project.py | Changes file_ext from enum to varchar |
| src/spyglass/common/common_interval.py | Adds shape check for interval conversion |
| src/spyglass/common/common_ephys.py | Refactors LFP table to tripartite make pattern |
| src/spyglass/behavior/v1/moseq.py | Refactors to tripartite make pattern |
| docs/src/ForDevelopers/CustomPipelines.md | Documents tripartite make pattern |
| docs/src/Features/Mixin.md | Removes transaction protection documentation |
| CHANGELOG.md | Notes infrastructure change |
Comments suppressed due to low confidence (1)
src/spyglass/spikesorting/v0/spikesorting_sorting.py:307
- Normal methods should have 'self', rather than 'key', as their first parameter.
def make_insert(key, sorting_path, time_of_sort):
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
edeno
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. @samuelbray32 do you see anything that would prevent merging?
| IntervalList.insert1(lfp_valid_times.as_dict, replace=True) | ||
| AnalysisNwbfile().log(key, table=self.full_table_name) | ||
| self.insert1(key) | ||
| self.insert1(dict(key, **added_key)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| self.insert1(dict(key, **added_key)) | |
| AnalysisNwbfile().add(key["nwb_file_name"], lfp_file_name) | |
| self.insert1(dict(key, **added_key)) |
This needs run down here now, no?
| "KEY", limit=kwargs.get("limit", None) | ||
| ) | ||
|
|
||
| if use_transact is False: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think people have custom tables that are using this feature. Do we want to give some time to migrate before removing it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. Removing the feature was premature. Better to add deprecation warning
Description
This PR replaces our
upstream_hashprotections with the generator-make approach in datajoint 0.14.6Checklist:
CITATION.cffaltersnippet for release notes.CHANGELOG.mdwith PR number and description.